<template>
  <div class="subject">
    <span>{{ item.firstNum}}</span>
    <span>+</span>
    <span>{{ item.secondNum }}</span>
    <span>=</span>
    <input type="number" v-model="result"/>
    <button @click="submit">提交</button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      result:''
    }
  },

  props:['item'],
  methods:{
    submit() {
      
      if(this.result.trim() == '') return alert('请输入你的答案')
 
      
      this.$emit('resl',this.item.firstNum + this.item.secondNum == this.result)
      // console.log((this.item.firstNum + this.item.secondNum == Number(this.item.res)));
      
    }
  },
  
};
</script>

<style scoped>
.subject {
  margin: 5px;
  padding: 5px;
  font-size: 20px;
}
.subject span {
  display: inline-block;
  text-align: center;
  width: 20px;
}
.subject input {
  width: 50px;
  height: 20px;
}
</style>